﻿


@{
    Layout = "";
}
<style>
    .ngdialog.ngdialog-theme-plain .ngdialog-content {
        width: 25% !important;
    }
</style>
<div ng-controller="RechargeController">
    <h3>会员资金记录</h3>

    <div class="panel panel-default" ng-class="{ 'whirl standard': isLoading}">
        <div class="panel-heading">
            <div class="form-inline ng-pristine ng-valid">
                <div class="form-group">
                    <button type="button" class="btn btn-labeled btn-success" ng-click="add()">
                        <span class="btn-label">
                            <em class="fa fa-plus"></em>
                        </span>新增记录
                    </button>

                    <button type="button" class="btn btn-labeled btn-primary" ng-click="$state.go('app.memberlist')">
                        <span class="btn-label">
                            <em class="fa fa-reply"></em>
                        </span>返回
                    </button>
                </div>
                @*<div class="form-group">
                        <button type="submit" class="btn btn-labeled btn-success" ng-click="positionManagementUpdataView(0)">
                            <span class="btn-label">
                                <em class="fa fa-plus"></em>
                            </span>新增
                        </button>
                    </div>*@
            </div>
        </div>
        <div class="panel-body">
            <div class="table-responsive">
                <table ng-table="tableParams" class="table table-striped table-bproducted table-hover">
                    <tbody>
                        <tr ng-repeat="item in $data">
                            <td data-title="'变动时间'" class="text-center">{{item.AddTime}}</td>
                            <td data-title="'操作人'" class="text-center">{{item.AddUserId>0?item.AddUserName:''}}</td>
                            <td data-title="'备注'" class="text-center">{{item.Note}}</td>
                            <td data-title="'用户资金'" class="text-center">{{item.Amount}}</td>
                            <td data-title="'用户积分'" class="text-center">{{item.Point}}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script>
    App.controller('RechargeController', [
    '$scope', '$resource', '$state', '$route', '$http', 'ngTableParams', 'ngTableDataService', 'Notify', '$filter', 'ngDialog', "$stateParams", "$timeout", "toaster",
        function ($scope, $resource, $state, $route, $http, ngTableParams, ngTableDataService, Notify, $filter, ngDialog, $stateParams, $timeout, toaster) {
            'use strict';
            $scope.isLoading = true;
            //数据查询
            $scope.tableParams = new ngTableParams({
                page: 1,
                count: 10,
                sorting: {
                    Id: 'desc'     // 初始化排序
                }
            }, {
                getData: function ($defer, params) {
                    $scope.isLoading = true;
                    var requestParams = {
                        Skip: (params.page() - 1) * params.count(),
                        Take: params.count(),
                        Keywords: $scope.Keywords,
                        MemberId: $stateParams.id
                    };
                    $http.post('/Member/GetMemberBalanceDetailList', ngTableDataService.getServerSideParams(params.orderBy().toString(), params, requestParams))
                        .success(function (data, status) {
                            params.total(data.count);
                            $defer.resolve(data.data);
                            $scope.isLoading = false;
                        });
                }
            });

            $scope.add = function ()
            {
                $state.go('app.addrecharge', { "id": $stateParams.id });
            }


        }
    ]);
</script>

